package com.example.jasonrpc.client.simple;

import com.example.jasonrpc.client.ClientConfig;
import com.example.jasonrpc.client.RpcClient;
import com.example.jasonrpc.common.ReflectionUtils;

public class SimpleRpcClient extends RpcClient {
    public SimpleRpcClient(ClientConfig config) {
        super(config);
    }

    @Override
    protected void init(ClientConfig config) {
        this.encoder = ReflectionUtils.newInstance(config.getEncoderClass());
        this.decoder = ReflectionUtils.newInstance(config.getDecoderClass());
        this.selector = ReflectionUtils.newInstance(config.getSelectorClass());
        this.selector.init(config.getDirectories(), config.getConnectCount(), config.getTransportClientClass());
    }
}
